package me.baicai.weixin.identity.repository;

import me.baicai.weixin.application.Result;
import me.baicai.weixin.entity.identity.AgentApply;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Repository
public interface AgentApplyRepository extends JpaRepository<AgentApply, Long> {
    List<AgentApply> findAllByType(String Type);
    AgentApply findAgentApplyById(Integer id);

    @Transactional
    @Modifying
    @Query(value = "delete from agent_apply where id = ?1", nativeQuery = true)
    void deleteById(Integer id);

    Page<AgentApply> findAllByType(String type, Pageable pageable);
}
